import Vue from 'vue'
import axios from 'axios'
import App from './App'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import httpInterceptors from './http'
import utils from '@/modules/utils'
import routerFilter from './router/filter.js'
import './assets/theme/index.css'
if (!process.env.IS_WEB) { Vue.use(require('vue-electron')) }
let url = 'https://service-f9qfkv8j-1251387687.ap-shanghai.apigateway.myqcloud.com/release/higame'
axios
  .get(url)
  .then(res => {
    if (process.env.NODE_ENV == 'development') {
      res.data.host = 'http://49.235.179.199:2000';

    }
    axios.defaults.timeout = 10000; //设置请求时间
    axios.defaults.baseURL = res.data.host;//设置默认接口地址
    axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
    axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'

    Vue.prototype.$http = axios
    Vue.prototype.$utils = utils
    Vue.prototype.$imagePath = res.data.host + '/upload/image/';
    Vue.prototype.$htmlPath = res.data.host + '/upload/html/';
    Vue.config.productionTip = false
    Vue.prototype.$higame = res.data
    Vue.use(ElementUI)
    Vue.use(httpInterceptors)
    Vue.use(routerFilter)
    store.dispatch("get_games")
    new Vue({
      components: { App },
      router,
      store,
      template: '<App/>'
    }).$mount('#app')
  })

